package com.dt.config;

import lombok.extern.slf4j.Slf4j;
import redis.clients.jedis.Jedis;

/**
 * @Auther: dengtao
 * @Date: 2019/11/25 17:18
 * @Description:
 */
@Slf4j
public class RedisConfig {

    /** 单例模式 */
    private static RedisConfig instance = new RedisConfig();

    public static Jedis jedis;

    /**
     * 如果配置启动分布式，则自动初始化jedis
     * */
    private RedisConfig(){
        this.jedis = new Jedis(ConfigFactory.RedisIP);
        log.info("Redis启动,IP："+ConfigFactory.RedisIP);
    }

    public static RedisConfig getInstance(){
        return instance;
    }

}
